package com.zzyl.nursing.job;
import com.zzyl.nursing.service.IReservationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;


@Component("AutoExpiringScheduledTask")
@Slf4j
public class AutoExpiringScheduledTask {

    @Autowired
    private IReservationService reservationService;



    public void CheckExpiredAppointments() {
        log.info("开始执行预约过期任务，当前时间：{}", LocalDateTime.now());

        int updatedCount = reservationService.markReservationsasExpired();

        log.info("预约过期任务执行成功，更新{}条过期数据", updatedCount);
    }
}